The Elder Scrolls Forums

TES Construction Set and Plugins >> General TES Construction Set

Pages: 1 | 2 | (show all)
MysticResearcher
Novice

Reged: 07/28/04
Posts: 23
Loc: Tul Urvith, of couse.
Fear My Elite Research Skills! or Base Stats.
      #2893479 - 08/06/04 05:23 AM

Please forgive me for any spelling mistakes. I am up way to late and need sleep.

I have found out how to get the base stats and skills through scripting.

To make a long story short:

First
You can't mod a stat over 100.
If you do the stat doesn't change.
So we can test to see if a stat is at 100.

Second:
Damage spells don't wear off and don't leave spell effects.
Drain and absorb spells apply thier damage when they start, and remove them when they end.
This means that removing a spell effect can have odd side effects.
(However this can be worked around with a restore script and then redamagind the stat or skill.)

The solution in summary:
Get the skill so we know how damaged it is.
Restore the skill
Get the skill so we know what it was without damage.
Mod the skill up till it "bounces" at 100
By keeping track of the mod's we do, we now know the base skill.
Then we just mod that bad boy down and Re-Damage it.

The only catch I found so far is that it won't work while menus are up.
Since you can't add a recover spell to the player while they are in a menu.

My Next post will have a script as an example.

PS. Thanks to Madd_Mugsy and Sederien, it's their fault I figured it out.

--------------------
----------------------------------------

Shhhh! The voices in my head are trying to tell me something.

Edited by MysticResearcher (08/06/04 05:33 AM)

Post Extras: Print Post   Remind Me!   Notify Moderator  
MysticResearcher
Novice

Reged: 07/28/04
Posts: 23
Loc: Tul Urvith, of couse.
Re: Fear My Elite Research Skills! or Base Stats. [Re: MysticResearcher]
      #2893492 - 08/06/04 05:26 AM

Sorry about the formatting.
--------------------------------------------------------------
Begin WM_CalculateBaseStrength

;Set up the variables we will need
Long CurrentStep ; To keep track of what frame we are in.
Long ReportedStat ; To Calculate Damage.
Long UndamagedStat ; We need this to calculate the BaseStrength
Long StatDamage ; We can tell how damaged it was.

Long CurrentStat ; For the 100 Limit Bounce check
Long LastStat ; For the 100 Limit Bounce check
Long BaseStat ; This Variable will end up with the base stat.

Short TempDamage ; Used to Re-Damage a stat once we have figured the base.

Short FrameCounter ; Used to keep this from happening too often.

If (MenuMode == 0)
; Step one
If ( CurrentStep == 0 )
Set ReportedStat To ( player->GetStrength ) ; Get the damaged strength.
player->AddSpell "WM_RestoreStrength" ; Remove the damage from the equation.
Set CurrentStep to 1
EndIf
If ( CurrentStep == 1 )
If ( Player->GetSpellEffects, "WM_RestoreStrength" == 1)
Set UndamagedStat to ( Player->GetStrength )
Set StatDamage To ( UndamagedStat - ReportedStat )

Set LastStat to -1
Set BaseStat to 101
Set CurrentStat to ( Player->GetStrength )
While ( LastStat != CurrentStat )
Set BaseStat to ( BaseStat - 1)
Set LastStat to ( CurrentStat )
player->ModStrength 1
Set CurrentStat To ( Player->GetStrength)

If ( BaseStat < 0 )
Set LastStat To -1
Set CurrentStat To -1
EndIf
EndWhile

Set CurrentStat to ( Player->GetStrength )
While ( CurrentStat > UndamagedStat )
player->ModStrength -1
Set CurrentStat to ( Player->GetStrength )
EndWhile

player->RemoveSpell "WM_RestoreStrength"
Set CurrentStep to 2
EndIf
EndIf

If ( CurrentStep == 2 )
If ( Player->GetSpellEffects, "WM_RestoreStrength" == 0)
Set TempDamage to StatDamage
If TempDamage >= 64
player->AddSpell "WM_Damage_Strength_64"
Set TempDamage to ( TempDamage - 64 )
EndIf
If TempDamage >= 32
player->AddSpell "WM_Damage_Strength_32"
Set TempDamage to ( TempDamage - 32 )
EndIf
If TempDamage >= 16
player->AddSpell "WM_Damage_Strength_16"
Set TempDamage to ( TempDamage - 16 )
EndIf
If TempDamage >= 8
player->AddSpell "WM_Damage_Strength_8"
Set TempDamage to ( TempDamage - 8 )
EndIf
If TempDamage >= 4
player->AddSpell "WM_Damage_Strength_4"
Set TempDamage to ( TempDamage - 4 )
EndIf
If TempDamage >= 2
player->AddSpell "WM_Damage_Strength_2"
Set TempDamage to ( TempDamage - 2 )
EndIf
If TempDamage >= 1
player->AddSpell "WM_Damage_Strength_1"
Set TempDamage to ( TempDamage - 1 )
EndIf
Set CurrentStep to 3
EndIf
EndIf

If ( CurrentStep == 3 )
Set CurrentStat to ( Player->GetStrength )
If ( CurrentStat <= ReportedStat )
player->RemoveSpell "WM_Damage_Strength_64"
player->RemoveSpell "WM_Damage_Strength_32"
player->RemoveSpell "WM_Damage_Strength_16"
player->RemoveSpell "WM_Damage_Strength_8"
player->RemoveSpell "WM_Damage_Strength_4"
player->RemoveSpell "WM_Damage_Strength_2"
player->RemoveSpell "WM_Damage_Strength_1"
Set CurrentStep to 4
EndIf
EndIf

If ( CurrentStep == 4 )
Set FrameCounter to ( FrameCounter + 1 )
If ( FrameCounter == 120 )
Set FrameCounter to 0
Set CurrentStep to 0
EndIf
EndIf
EndIf
End WM_NaturalStrength
--------------------------------------------------------------
WM are my initials. :P
Now I want Mad Props for this.
(And just what are props anyway?)

--------------------
----------------------------------------

Shhhh! The voices in my head are trying to tell me something.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Iudas
Disciple

Reged: 10/30/02
Posts: 1197
Re: Fear My Elite Research Skills! or Base Stats. [Re: MysticResearcher]
      #2893735 - 08/06/04 08:04 AM

Props = Things used on TV shows and movies to make the pretend look real.

or

Props = Proper respects for a job well done.

Either way have a mad props or two

Post Extras: Print Post   Remind Me!   Notify Moderator  
Limorkil
Adept

Reged: 08/28/02
Posts: 388
Loc: Atlanta, Georgia, USA
Re: Fear My Elite Research Skills! or Base Stats. [Re: Iudas]
      #2894334 - 08/06/04 12:38 PM

Props for the research!

What happens if strength is fortified, or fortified and damaged?

What happens if strength is drained/absorbed and the spell wears off in the same frames?


--------------------
Zorremalku the Dunmer Phantom Elite (Xbox)
Level: 18
High Skills: Short Blade (80) Mysticism (71) Destruction (64)
Factions: Temple(8), Telvanni(6), Mages(8), Morag Tong(7)
Current loc/activity: Stuck in Sadrith Mora for the moment while Limorkil's obsession with Leifang runs its course
Updated: 8/9/04

Post Extras: Print Post   Remind Me!   Notify Moderator  
Madd_Mugsy
Adept

Reged: 07/14/04
Posts: 220
Loc: Waiting for my XPS :D
Re: Fear My Elite Research Skills! or Base Stats. [Re: Limorkil]
      #2894447 - 08/06/04 01:08 PM

Quote:

What happens if strength is drained/absorbed and the spell wears off in the same frames?




From what I've seen, the best time to get the base stats is when the player is sleeping/just woken up/leveled This means that you don't need to worry about when he is casting spells.

A simple way that i'm going to use in the next version of my mod, is to check the attributes when the player levels:

1) Store the base value in a script when the player starts a new game
2) Add/subtract to this value as you mod/set your stat
3) When the player sleeps, set a temp variable with the current stat
4) When they wake up, check to see if they've leveled
5) If they have, get the difference between the temp variable and the current stat, and add that to the base

I haven't tested this yet, but I've got my fingers crossed

Any comments?

EDIT:

Also, you only need step 1 & 2 for skills, since they don't change when you level.

ANOTHER EDIT:

I just thought... this may not work if you run a whole bunch of mods that change your stats

EDIT #3:

If anyone is interested here is the code:

Code:

; ----------------------------------------------------------------------------------------------------
; Check for attribute increase on level up
; ----------------------------------------------------------------------------------------------------
If ( GetPCSleep == 1 )
Set Slept To 1
Set Last_Strength To ( Player->GetStrength )
Set Last_Endurance To ( Player->GetEndurance )
Set Last_Agility To ( Player->GetAgility )
Set Last_Intelligence To ( Player->GetIntelligence )
Set Last_Willpower To ( Player->GetWillpower )
Set Last_Personality To ( Player->GetPersonality )
Set Last_Speed To ( Player->GetSpeed )
Set Last_Luck To ( Player->GetLuck )

Else
If ( Slept == 1 )
If ( Player->GetLevel > LastLevel )
Set LastLevel To ( Player->GetLevel )

Set Diff To ( Player->GetStrength - Last_Strength )
If ( Diff > 0 )
Set Base_Strength To ( Base_Strength + Diff )
EndIf

Set Diff To ( Player->GetAgility - Last_Agility )
If ( Diff > 0 )
Set Base_Agility To ( Base_Agility + Diff )
EndIf

Set Diff To ( Player->GetEndurance - Last_Endurance )
If ( Diff > 0 )
Set Base_Endurance To ( Base_Endurance + Diff )
EndIf

Set Diff To ( Player->GetIntelligence - Last_Intelligence )
If ( Diff > 0 )
Set Base_Intelligence To ( Base_Intelligence + Diff )
EndIf

Set Diff To ( Player->GetWillpower - Last_Willpower )
If ( Diff > 0 )
Set Base_Willpower To ( Base_Willpower + Diff )
EndIf

Set Diff To ( Player->GetPersonality - Last_Personality )
If ( Diff > 0 )
Set Base_Personality To ( Base_Personality + Diff )
EndIf

Set Diff To ( Player->GetSpeed - Last_Speed )
If ( Diff > 0 )
Set Base_Speed To ( Base_Speed + Diff )
EndIf

Set Diff To ( Player->GetLuck - Last_Luck )
If ( Diff > 0 )
Set Base_Luck To ( Base_Luck + Diff )
EndIf

EndIf
Else
Set Slept To 0
EndIf
EndIf





Please let me know if I missed something

--------------------
If you hate working for those 5x multipliers (and would maybe like to uncap all your stats and skills), check out the Madd Leveler


Edited by Madd_Mugsy (08/06/04 01:38 PM)

Post Extras: Print Post   Remind Me!   Notify Moderator  
MysticResearcher
Novice

Reged: 07/28/04
Posts: 23
Loc: Tul Urvith, of couse.
Re: Fear My Elite Research Skills! or Base Stats. [Re: Madd_Mugsy]
      #2895184 - 08/06/04 04:24 PM

Limorkil:

What happens if strength is fortified, or fortified and damaged?

Fortified:
It Bounces up if it's fortified, so it can "see past" fortification.
Fortified and damaged:
It restores the damage keeping track of how much there was, then bounces up to "see past" the fortification. Then re-damages the stat.

What happens if strength is drained/absorbed and the spell wears off in the same frames?

Very good question, there is a window (when the restoration effect is running and just after it) where the spell knows how damaged you were, and is gonna stick it back onto you wether the original cause is still there or not.

I was gonna team it up with a script to detect combat by sound so that if you were in combat plus like 30 seconds then it won't check (That way the script won't damage the stat incorrectly because of recent spell use.)

Madd_Mugsy:
Fury drains skills, and it's a constant effect so it'll show up on getskill when you level.

Any constant fortify or drain will show up on getstat even after sleeping.

And you are right in that for the standard game checking when they wake from sleeping should mean that the player has no spells about to be removed, but I wanted something that's likely to work for your level mod as well. It's always up to the scripter how they want to implement (sp?) this. There will be better implementations than mine, but I wanted people to know that it could be done and how.

Looking at your code, you are still subject to damage and drain/fortify effects on skills and spells that are constant enchants. Not that it won't work, but I was looking into getting past those numbers to the base stat.

And thanks for the props, all.

--------------------
----------------------------------------

Shhhh! The voices in my head are trying to tell me something.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Madd_Mugsy
Adept

Reged: 07/14/04
Posts: 220
Loc: Waiting for my XPS :D
Re: Fear My Elite Research Skills! or Base Stats. [Re: MysticResearcher]
      #2895416 - 08/06/04 05:41 PM

Quote:

Fury drains skills, and it's a constant effect so it'll show up on getskill when you level.

Any constant fortify or drain will show up on getstat even after sleeping.






Actually, it doesn't matter what effects are active. I'm getting the difference between the skill after leveling and the skill before the player went to sleep and adding the difference to the base, which I maintain on my own. So effects won't matter.

Formula:

New Base = (Stat After leveling - Stat Before Leveling) + Base

So constant effects should not matter.

I'm actually just about to test this thing out...

EDIT:

Meh. It didn't work. I'll keep fiddling with it

--------------------
If you hate working for those 5x multipliers (and would maybe like to uncap all your stats and skills), check out the Madd Leveler


Edited by Madd_Mugsy (08/06/04 06:18 PM)

Post Extras: Print Post   Remind Me!   Notify Moderator  
MysticResearcher
Novice

Reged: 07/28/04
Posts: 23
Loc: Tul Urvith, of couse.
Re: Fear My Elite Research Skills! or Base Stats. [Re: Madd_Mugsy]
      #2895579 - 08/06/04 06:28 PM

Sweet,

Teach me to skim scripts on the message board.

Getting just the information you want, when it's the only thing that is likely to change.

But I wonder how it is going to handle the bitter cup when it does a modstrength 20? That change occures outside of sleep, and leveling. Actually any modstat function will cause this, but I don't think that there are that many in the game.

As for skills, they are a whole different issue.

Edit:
:P So what didn't work? If I can help find a better way of doing this I'll be happy. My way is still big and clunky.

--------------------
----------------------------------------

Shhhh! The voices in my head are trying to tell me something.

Edited by MysticResearcher (08/06/04 06:33 PM)

Post Extras: Print Post   Remind Me!   Notify Moderator  
Madd_Mugsy
Adept

Reged: 07/14/04
Posts: 220
Loc: Waiting for my XPS :D
Re: Fear My Elite Research Skills! or Base Stats. [Re: MysticResearcher]
      #2896392 - 08/06/04 10:44 PM

Sorry mate, I ment no disrespect <- for putting this issue out to the masses. I've seen a few debates over it in my forum searches.

While I did ponder the idea of calculating the base stats while sleeping, props to Cyrano for sending me some sample code & descriptions on how to do it.

Why my script didn't work:
1) the slept variable didn't work and isn't really needed so I took it out
2) my script was only running once every two seconds, so it didn't actually catch the sleep event

BTW, an interesting side note... DON'T pop up a messagebox with a button on it while the player is sleeping. Freezes up the whole thing

EDIT:

I put back the slept variable, as it wasn't catching fortify spell removal when the pc only slept for an hour. So now I'm trying to catch it when the pc has woken up...

I'll post my new code when it's working...

--------------------
If you hate working for those 5x multipliers (and would maybe like to uncap all your stats and skills), check out the Madd Leveler


Post Extras: Print Post   Remind Me!   Notify Moderator  
MysticResearcher
Novice

Reged: 07/28/04
Posts: 23
Loc: Tul Urvith, of couse.
Re: Fear My Elite Research Skills! or Base Stats. [Re: Madd_Mugsy]
      #2896670 - 08/07/04 12:12 AM

No sweat, I didn't think it was disrespect, heck I was worried that you thought I was slamming your ideas. But they seem far more fluid for the long haul than my idea.

Chalk it up to the difference between wanting the base stats on rare occasions and wanting them fairly often.

Splitting the script into a sleeping and waking section was my thought when you described the problem. Or maybe even a waking then sleeping then waking section depending on how it goes.

But here's something that's gonna irk me now that I think about it:
Just how long ( in script runs ) is the sleep event?
Something for me to tackle in a little bit, I guess.



--------------------
----------------------------------------

Shhhh! The voices in my head are trying to tell me something.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Madd_Mugsy
Adept

Reged: 07/14/04
Posts: 220
Loc: Waiting for my XPS :D
Re: Fear My Elite Research Skills! or Base Stats. [Re: MysticResearcher]
      #2896776 - 08/07/04 12:52 AM

Here is the problematic part of the code so far:

Code:


If ( GetPCSleep == 1 )
Set Slept To 1
Else
; ----------------------------------------------------------------------------------------------------
; Store stats on waking
; ----------------------------------------------------------------------------------------------------
If ( Slept == 1 )
Set Last_Strength To ( Player->GetStrength )
Set Last_Endurance To ( Player->GetEndurance )
Set Last_Agility To ( Player->GetAgility )
Set Last_Intelligence To ( Player->GetIntelligence )
Set Last_Willpower To ( Player->GetWillpower )
Set Last_Personality To ( Player->GetPersonality )
Set Last_Speed To ( Player->GetSpeed )
Set Last_Luck To ( Player->GetLuck )

Set Slept To 0
EndIf

; continue with other stuff
EndIf



The problem is that the set last_stat part doesn't fire properly when the PC levels up. Actually the problem is that the level up menu stops the fortify/drain effects from being removed when the player only rests for one hour until after the menu goes away. So I end up with inflated last_stat values.

Not sure of a way around this besides telling the player to rest >=2 hours when they level

--------------------
If you hate working for those 5x multipliers (and would maybe like to uncap all your stats and skills), check out the Madd Leveler


Post Extras: Print Post   Remind Me!   Notify Moderator  
MysticResearcher
Novice

Reged: 07/28/04
Posts: 23
Loc: Tul Urvith, of couse.
Re: Fear My Elite Research Skills! or Base Stats. [Re: Madd_Mugsy]
      #2897180 - 08/07/04 03:25 AM

It's a timing issue. The same one I ran into with my script, but a strange place to run into it.

The issue is that effects don't wear off right when they are removed. It takes a couple of frames. When you sleep for 2 hours appearantly you have enough frames while sleeping. FYI When you sleep for 1 hour you get two frames, when you sleep for 2 hours you get 5 frames. (At least I did.)

The only way I can see to work around this would be to try to increase the number of frames per hour slept. I tried changing how fast time passed in the game but it was a no go.

I am gonna keep hunting for a bit, though.

Edited:
Or Disabling the Menu's while they are asleep so that the level up menu won't show. Hmm.. Now is that possible?


--------------------
----------------------------------------

Shhhh! The voices in my head are trying to tell me something.

Edited by MysticResearcher (08/07/04 03:32 AM)

Post Extras: Print Post   Remind Me!   Notify Moderator  
MysticResearcher
Novice

Reged: 07/28/04
Posts: 23
Loc: Tul Urvith, of couse.
Re: Fear My Elite Research Skills! or Base Stats. [Re: MysticResearcher]
      #2897384 - 08/07/04 05:19 AM

Here's some useless knowledge that you might find entertaining.

I didn't find out how to increase the frames per hour when you sleep, but I did find out how to shorten them.

If you Set Chargen to 11 then you can display a message box, with a button, while the player is sleeping. If you set chargen back to -1 when they are done sleeping then they can click and all. Mind you this is on Morrowind with out expansions so your milage might vary.

And the fun part is if you do this the level up menu doesn't show.
It still won't get the spell effects to wear off, but you can setup a counter to count some frames, once the player is out of menu mode, then go ahead and check.

Course this means that you have to script a way for the level up window to come up.

Would you belive that I found this out because my test chararacter was using the CharGenDagger?

I think I am running outta ways this might work. You got any more ideas?

--------------------
----------------------------------------

Shhhh! The voices in my head are trying to tell me something.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Madd_Mugsy
Adept

Reged: 07/14/04
Posts: 220
Loc: Waiting for my XPS :D
Re: Fear My Elite Research Skills! or Base Stats. [Re: MysticResearcher]
      #2897952 - 08/07/04 11:15 AM

Ok, I think I can use this info... I can bring up the level up menu, and I'm tracking skill points to level already, but I'm not differentiating between major and minor and misc skills. How do i get these via scripting?

EDIT: It still doesn't get the last values right though...

--------------------
If you hate working for those 5x multipliers (and would maybe like to uncap all your stats and skills), check out the Madd Leveler


Edited by Madd_Mugsy (08/07/04 12:02 PM)

Post Extras: Print Post   Remind Me!   Notify Moderator  
Madd_Mugsy
Adept

Reged: 07/14/04
Posts: 220
Loc: Waiting for my XPS :D
Re: Fear My Elite Research Skills! or Base Stats. [Re: Madd_Mugsy]
      #2898141 - 08/07/04 12:32 PM

Got it to work!

There was a timer on my initial code that waited one second before checking the level. I moved it down and now it all works! The getstat returns the stat w/spell fortifications still applied this way

Code:

Code:

If ( GetPCSleep == 1 )
Set Slept To 1
Else
; ----------------------------------------------------------------------------------------------------
; Store stats on waking
; ----------------------------------------------------------------------------------------------------
If ( Slept == 1 )
Set Last_Strength To ( Player->GetStrength )
Set Last_Endurance To ( Player->GetEndurance )
Set Last_Agility To ( Player->GetAgility )
Set Last_Intelligence To ( Player->GetIntelligence )
Set Last_Willpower To ( Player->GetWillpower )
Set Last_Personality To ( Player->GetPersonality )
Set Last_Speed To ( Player->GetSpeed )
Set Last_Luck To ( Player->GetLuck )

Set Slept To 0
EndIf

; ----------------------------------------------------------------------------------------------------
; Get Base Attributes on level up
; ----------------------------------------------------------------------------------------------------

If ( Player->GetLevel > Last_Level )
Set Last_Level To ( Player->GetLevel )

Set Diff To ( Player->GetStrength - Last_Strength )
If ( Diff > 0 )
Set Base_Strength To ( Base_Strength + Diff )
EndIf

Set Diff To ( Player->GetAgility - Last_Agility )
If ( Diff > 0 )
Set Base_Agility To ( Base_Agility + Diff )
EndIf

Set Diff To ( Player->GetEndurance - Last_Endurance )
If ( Diff > 0 )
Set Base_Endurance To ( Base_Endurance + Diff )
EndIf

Set Diff To ( Player->GetIntelligence - Last_Intelligence )
If ( Diff > 0 )
Set Base_Intelligence To ( Base_Intelligence + Diff )
EndIf

Set Diff To ( Player->GetWillpower - Last_Willpower )
If ( Diff > 0 )
Set Base_Willpower To ( Base_Willpower + Diff )
EndIf

Set Diff To ( Player->GetPersonality - Last_Personality )
If ( Diff > 0 )
Set Base_Personality To ( Base_Personality + Diff )
EndIf

Set Diff To ( Player->GetSpeed - Last_Speed )
If ( Diff > 0 )
Set Base_Speed To ( Base_Speed + Diff )
EndIf

Set Diff To ( Player->GetLuck - Last_Luck )
If ( Diff > 0 )
Set Base_Luck To ( Base_Luck + Diff )
EndIf

EndIf

; ----------------------------------------------------------------------------------------------------
; Only run once per second -- must come after level check
; ----------------------------------------------------------------------------------------------------

Set Timer To ( Timer + GetSecondsPassed )
If ( Timer <= 1 )
Return
ElseIf ( mlStatus != 0 )
Return
Else
Set Timer To 0
EndIf

;; other stuff....





--------------------
If you hate working for those 5x multipliers (and would maybe like to uncap all your stats and skills), check out the Madd Leveler


Post Extras: Print Post   Remind Me!   Notify Moderator  
MysticResearcher
Novice

Reged: 07/28/04
Posts: 23
Loc: Tul Urvith, of couse.
Re: Fear My Elite Research Skills! or Base Stats. [Re: Madd_Mugsy]
      #2899010 - 08/07/04 04:31 PM

Sweet,

You rock Mugsy.

Now as for telling the difference between primary,secondary, and misc skills. I have some ideas about that, so I guess I might as well try to figure that out now.

--------------------
----------------------------------------

Shhhh! The voices in my head are trying to tell me something.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Madd_Mugsy
Adept

Reged: 07/14/04
Posts: 220
Loc: Waiting for my XPS :D
Re: Fear My Elite Research Skills! or Base Stats. [Re: MysticResearcher]
      #2899224 - 08/07/04 05:54 PM

No real need to now. The above code works w/out them.

--------------------
If you hate working for those 5x multipliers (and would maybe like to uncap all your stats and skills), check out the Madd Leveler


Post Extras: Print Post   Remind Me!   Notify Moderator  
Dionysius
Novice

Reged: 09/21/03
Posts: 21
Re: Fear My Elite Research Skills! or Base Stats. [Re: MysticResearcher]
      #2906673 - 08/09/04 08:16 AM

I think that this may come in useful for my aedric amulet mod. Thanks for the info.

Post Extras: Print Post   Remind Me!   Notify Moderator  
MysticResearcher
Novice

Reged: 07/28/04
Posts: 23
Loc: Tul Urvith, of couse.
Re: Fear My Elite Research Skills! or Base Stats. [Re: Dionysius]
      #2908140 - 08/09/04 04:12 PM

Dionysius,
Here is a more optimized version of the code.
I removed the while loops, and found a faster way to get the base stat.
(This makes it about 10 times faster for low stats. )

Code:

Begin WM_CalculateBaseIntelligence

; Global Variables.
; Short BaseIntelligence ; The Global that will hold the stat.
; Short BaseIntelligenceModifier ; A global variable for level cap removers.

;Set up the variables we will need
Long CurrentStep ; To keep track of what frame we are in.
Long ReportedStat ; To Calculate Damage.
Long StatDamage ; We can tell how damaged it was.
Long UndamagedStat ; We need this to calculate the base stat.
Long InvertedStat ; We will use this to calculate the base stat.

Long CurrentStat ; For the 100 Limit Bounce check, and to Re-Damage the stat.
Long BaseStat ; This Variable will end up with the base stat.

Short TempDamage ; Used to Re-Damage a stat once we have figured the base.

; since we can't play with effects and curses in a menu, we don't work in menus.
If ( MenuMode == 1 )
Return
EndIf

; Step one
If ( CurrentStep == 0 )
; Get the damaged stat.
Set ReportedStat to ( Player -> GetIntelligence )
; Remove the damage from the equation.
Player -> AddSpell, "WM_Ability_Restore_Int_100"
; On to the next phase.
Set CurrentStep to 1
EndIf

; Step two
If ( CurrentStep == 1 )
; Make sure that we are working with an undamaged stat.
If ( Player -> GetSpellEffects, "WM_Ability_Restore_Int_100" == 1)
; get the undamaged stat
Set UndamagedStat to ( Player -> GetIntelligence )
; figure out how much it was damaged
Set StatDamage to ( UndamagedStat - ReportedStat )

; Here's where we "bounce" the stat of the ModSKILL ceiling of 100.
Player -> ModIntelligence, 101

; Now we get the current stat
Set CurrentStat to ( Player -> GetIntelligence )
; InvertedStat will hold the difference between the undamaged stat, and the
; bounced stat. (This should be equivilent to 100 - the actual Base Stat )
Set InvertedStat to ( CurrentStat - UndamagedStat )
; Now we invert the inverted stat to get the base stat.
Set BaseStat to ( 100 - InvertedStat )

; In newer versions of Morrowind this can be replaced with
; Player -> ModIntelligence ( -1 * InvertedStat) ; I think.
; Now we use a binary system to mod the base stat down.
If ( InvertedStat >= 64 )
Player -> ModIntelligence -64
Set InvertedStat to ( InvertedStat - 64 )
EndIf
If ( InvertedStat >= 32 )
Player -> ModIntelligence -32
Set InvertedStat to ( InvertedStat - 32 )
EndIf
If ( InvertedStat >= 16 )
Player -> ModIntelligence -16
Set InvertedStat to ( InvertedStat - 16 )
EndIf
If ( InvertedStat >= 8 )
Player -> ModIntelligence -8
Set InvertedStat to ( InvertedStat - 8 )
EndIf
If ( InvertedStat >= 4 )
Player -> ModIntelligence -4
Set InvertedStat to ( InvertedStat - 4 )
EndIf
If ( InvertedStat >= 2 )
Player -> ModIntelligence -2
Set InvertedStat to ( InvertedStat - 2 )
EndIf
If ( InvertedStat >= 1 )
Player -> ModIntelligence -1
Set InvertedStat to ( InvertedStat - 1 )
EndIf


; Set the global variable BaseIntelligence.
; BaseIntelligenceModifier is a global that can be used for OverLevel Enablers.
Set BaseIntelligence to ( BaseStat + BaseIntelligenceModifier )

; Now we need to remove our restoration effect so that we can re-damage
; the stat back as it was.
Player -> RemoveSpell, "WM_Ability_Restore_Int_100"
Set CurrentStep to 2
EndIf
EndIf

; Step Three
; Here we go through and apply all the damage stat curses to put the stat
; back where it belongs.
If ( CurrentStep == 2 )
If ( Player -> GetSpellEffects, "WM_Ability_Restore_Int_100" == 0)
Set TempDamage to StatDamage
If ( TempDamage >= 64 )
Player -> AddSpell, "WM_Curse_Damage_Int_64"
Set TempDamage to ( TempDamage - 64 )
EndIf
If ( TempDamage >= 32 )
Player -> AddSpell, "WM_Curse_Damage_Int_32"
Set TempDamage to ( TempDamage - 32 )
EndIf
If ( TempDamage >= 16 )
Player -> AddSpell, "WM_Curse_Damage_Int_16"
Set TempDamage to ( TempDamage - 16 )
EndIf
If ( TempDamage >= 8 )
Player -> AddSpell, "WM_Curse_Damage_Int_08"
Set TempDamage to ( TempDamage - 8 )
EndIf
If ( TempDamage >= 4 )
Player -> AddSpell, "WM_Curse_Damage_Int_04"
Set TempDamage to ( TempDamage - 4 )
EndIf
If ( TempDamage >= 2 )
Player -> AddSpell, "WM_Curse_Damage_Int_02"
Set TempDamage to ( TempDamage - 2 )
EndIf
If ( TempDamage >= 1 )
Player -> AddSpell, "WM_Curse_Damage_Int_01"
Set TempDamage to ( TempDamage - 1 )
EndIf
Set CurrentStep to 3
EndIf
EndIf

; Step Four
; And here we remove our curses so that play can continue as normal.
If ( CurrentStep == 3 )
Set CurrentStat to ( Player -> GetIntelligence )
If ( CurrentStat <= ReportedStat )
Player -> RemoveSpell, "WM_Curse_Damage_Int_64"
Player -> RemoveSpell, "WM_Curse_Damage_Int_32"
Player -> RemoveSpell, "WM_Curse_Damage_Int_16"
Player -> RemoveSpell, "WM_Curse_Damage_Int_08"
Player -> RemoveSpell, "WM_Curse_Damage_Int_04"
Player -> RemoveSpell, "WM_Curse_Damage_Int_02"
Player -> RemoveSpell, "WM_Curse_Damage_Int_01"
Set CurrentStep to 4
EndIf
EndIf

; A step so we can just stop and wait to be told to check again.
If ( CurrentStep == 4 )
Set CurrentStep to 0
StopScript WM_CalculateBaseIntelligence
EndIf

End WM_CalculateBaseIntelligence




--------------------
----------------------------------------

Shhhh! The voices in my head are trying to tell me something.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Dionysius
Novice

Reged: 09/21/03
Posts: 21
Re: Fear My Elite Research Skills! or Base Stats. [Re: MysticResearcher]
      #2915842 - 08/11/04 11:04 AM

Thanks Again!!!

Post Extras: Print Post   Remind Me!   Notify Moderator  
Madd_Mugsy
Adept

Reged: 07/14/04
Posts: 220
Loc: Waiting for my XPS :D
Re: Fear My Elite Research Skills! or Base Stats. [Re: Dionysius]
      #2916042 - 08/11/04 12:05 PM

BTW, don't forget that if you use my approach, you also need to check the skills when the player goes to jail.

--------------------
If you hate working for those 5x multipliers (and would maybe like to uncap all your stats and skills), check out the Madd Leveler


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1 | 2 | (show all)


Extra information
0 registered and 2 anonymous users are browsing this forum.

Moderator:  Umrahel, Freddo, Pete, Hungry Donner, Attrebus, Miltiades, tegger 

Print Thread

Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating: *****
Thread views: 241

Rate this thread
 
Jump to

The Elder Scrolls Homepage

*
UBB.threads™ 6.3

Click for Privacy Statement © 2003 Bethesda Softworks LLC, a ZeniMax Media company. All Rights Reserved.
PRIVACY POLICY | TERMS & CONDITIONS | LEGAL INFORMATION | CONTACT US